package com.example.sneakerappforme1105.bean;

import androidx.annotation.NonNull;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.PrimaryKey;

@Entity(tableName = "tb_address"
//        foreignKeys = {
//        @ForeignKey(
//                entity = User.class,
//                parentColumns = "userId",
//                childColumns = "userId",
//                onDelete = ForeignKey.CASCADE
//        )}
)
public class Address {
    @PrimaryKey(autoGenerate = true)
    @NonNull
    private Long addressId; // 自增主键
    private Long userId;    // 外键
    private String username; // 用户真实名
    private String phoneNumber; // 电话号码
    private String detailedAddress; // 详细地址

    // 构造函数
    public Address(Long userId,String username, String phoneNumber, String detailedAddress) {
        this.userId = userId;
        this.username = username;
        this.phoneNumber = phoneNumber;
        this.detailedAddress = detailedAddress;
    }

    @NonNull
    public Long getAddressId() {
        return addressId;
    }

    public void setAddressId(@NonNull Long addressId) {
        this.addressId = addressId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getDetailedAddress() {
        return detailedAddress;
    }

    public void setDetailedAddress(String detailedAddress) {
        this.detailedAddress = detailedAddress;
    }
}
